home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / internet / inter / html.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-03-08  |  3.3 KB  |  106 lines

  1. VERSION 2.00
  2. Begin Form frmHTML 
  3.    Caption         =   "HTML Source Viewer"
  4.    ClientHeight    =   8340
  5.    ClientLeft      =   210
  6.    ClientTop       =   1575
  7.    ClientWidth     =   12660
  8.    Height          =   8745
  9.    Left            =   150
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   8340
  12.    ScaleWidth      =   12660
  13.    Top             =   1230
  14.    Width           =   12780
  15.    Begin dsSocket dsSocket1 
  16.       DataSize        =   30000
  17.       Left            =   270
  18.       Linger          =   0   'False
  19.       LocalPort       =   0
  20.       RemoteDotAddr   =   ""
  21.       RemoteHost      =   ""
  22.       RemotePort      =   0
  23.       ServiceName     =   ""
  24.       Timeout         =   0
  25.       Top             =   720
  26.    End
  27.    Begin TextBox txtAnchor 
  28.       FontBold        =   0   'False
  29.       FontItalic      =   0   'False
  30.       FontName        =   "MS Sans Serif"
  31.       FontSize        =   9.75
  32.       FontStrikethru  =   0   'False
  33.       FontUnderline   =   0   'False
  34.       Height          =   360
  35.       Left            =   900
  36.       TabIndex        =   0
  37.       Top             =   90
  38.       Width           =   6360
  39.    End
  40.    Begin TextBox txtHTML 
  41.       FontBold        =   0   'False
  42.       FontItalic      =   0   'False
  43.       FontName        =   "MS Sans Serif"
  44.       FontSize        =   12
  45.       FontStrikethru  =   0   'False
  46.       FontUnderline   =   0   'False
  47.       Height          =   7755
  48.       Left            =   45
  49.       MultiLine       =   -1  'True
  50.       ScrollBars      =   2  'Vertical
  51.       TabIndex        =   1
  52.       Top             =   540
  53.       Width           =   12525
  54.    End
  55.    Begin Label Label1 
  56.       Caption         =   "Anchor:"
  57.       Height          =   285
  58.       Left            =   90
  59.       TabIndex        =   2
  60.       Top             =   135
  61.       Width           =   690
  62.    End
  63. DefInt A-Z
  64. Sub dsSocket1_Connect ()
  65.     hPos = InStr(UCase$(txtAnchor), "HTTP://")
  66.     If hPos Then
  67.         szHost$ = Mid$(txtAnchor, hPos + 7)
  68.         szHost$ = Left$(szHost$, InStr(szHost$, "/") - 1)
  69.         szCmd$ = "GET " & Mid$(txtAnchor, InStr(txtAnchor, szHost$) + Len(szHost$)) & Chr$(10)
  70.         txtHTML = ""
  71.         dsSocket1.Send = szCmd$
  72.     End If
  73. End Sub
  74. Sub dsSocket1_Receive (ReceiveData As String)
  75.     txtHTML = txtHTML & ReceiveData
  76. End Sub
  77. Sub Form_Unload (Cancel As Integer)
  78.     On Error Resume Next
  79.     dsSocket1.Action = DSSOCK_CLOSE
  80. End Sub
  81. Sub txtAnchor_KeyPress (KeyAscii As Integer)
  82.     If KeyAscii = 13 Then
  83.         hPos = InStr(UCase$(txtAnchor), "HTTP://")
  84.         If hPos Then
  85.             szHost$ = Mid$(txtAnchor, hPos + 7)
  86.             BS = InStr(szHost$, "/")
  87.             If BS Then
  88.                 szHost$ = Left$(szHost$, BS - 1)
  89.                 If dsSocket1.Socket Then
  90.                     dsSocket1.Action = DSSOCK_CLOSE
  91.                     DoEvents
  92.                 End If
  93.                 dsSocket1.RemotePort = 80
  94.                 dsSocket1.RemoteHost = szHost$
  95.                 Screen.MousePointer = 11
  96.                 On Error Resume Next
  97.                 dsSocket1.Action = DSSOCK_CONNECT
  98.                 Screen.MousePointer = 0
  99.                 If Err Then
  100.                     MsgBox Error
  101.                 End If
  102.             End If
  103.         End If
  104.     End If
  105. End Sub
  106.